package ru.urfc.portal.developer_tasks.ejb_tests;

import javax.ejb.EJB;

import ru.urfc.portal.developer_tasks.BaseTestEjb;
import ru.urfc.portal.developer_tasks.Initializer;
import ru.urfc.portal.managers.DeviceManager;
import ru.urfc.portal.model.Client;
import ru.urfc.portal.model.Branch;
import ru.urfc.portal.model.radio.Device;

public class DeviceManagerTestEjb extends BaseTestEjb {

	@EJB DeviceManager deviceManager;

	Client client;
	Client client2;
	Device device;
	
	@Override
	protected void setUp() throws Exception {
		client = findClient(Initializer.CONTRAGENT_NAME_MTS);
		client2 = findClient(Initializer.CONTRAGENT_NAME_QQ);
		device = exactlyOne(find(Branch.SVERD, Device.class, "number", Initializer.CLIENT_MTS_DEVICE_NUMBER));
	}
	
	public void testGetDeviceException() {
		deviceManager.getDevice(client.getId(), device.getId());
		setExpectedUserGetItemException();
		deviceManager.getDevice(client2.getId(), device.getId());
	}

	public void testGetDeviceNetException() {
		deviceManager.getDeviceNet(client.getId(), device.getId());
		setExpectedUserGetItemException();
		deviceManager.getDeviceNet(client2.getId(), device.getId());
	}
	
	public void testGetDeviceSectors() {
		deviceManager.getDeviceSectors(client.getId(), device.getId());
		setExpectedUserGetItemException();
		deviceManager.getDeviceSectors(client2.getId(), device.getId());
	}
	
	public void testGetDeviceCertificates() {
		deviceManager.getDeviceCertificates(client.getId(), device.getId());
		setExpectedUserGetItemException();
		deviceManager.getDeviceCertificates(client2.getId(), device.getId());
	}

	public void testGetDeviceMeasurements() {
		deviceManager.getDeviceMeasurements(client.getId(), device.getId());
		setExpectedUserGetItemException();
		deviceManager.getDeviceMeasurements(client2.getId(), device.getId());
	}	
	
	public void testGetDeviceStateChanges() {
		deviceManager.getDeviceStateChanges(client.getId(), device.getId());
		setExpectedUserGetItemException();
		deviceManager.getDeviceStateChanges(client2.getId(), device.getId());
	}
	
}
